import type { Meta, StoryObj } from '@storybook/vue3-vite';

import { fn } from 'storybook/test';

import JsonPreview from './index.vue';

const meta = {
  title: 'text/JsonPreview',
  component: JsonPreview,
  tags: ['autodocs'],
  argTypes: {
    data: {
      control: 'object',
      description: '要显示的 JSON 数据'
    },
    showLength: {
      control: 'boolean',
      description: '是否显示数组和对象的长度'
    },
    deep: {
      control: 'number',
      description: '展开的深度'
    }
  },
  args: {
    data: {},
    showLength: true,
    deep: 3,
  },

} satisfies Meta<typeof JsonPreview>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Primary: Story = {
  name: '基础用法',
  args: {
    ...meta.args,
    data: { key: 'value' },
  },
};